import org.assertj.core.util.DateUtil;
import org.junit.Test;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

public class other {
    @Test
    public void testIntMaxValue() {
        Integer max = Integer.MAX_VALUE;
        System.out.println(max);
        System.out.println(max);
        System.out.println(max);
        System.out.println(max);

    }

    @Test
    public void abxy() throws Exception {
        List<Date> aList = new ArrayList();
        List<Date> bList = new ArrayList();

        aList.add(stringToDate("2020-06-06 12:00:00"));
        bList.add(stringToDate("2020-06-06 15:00:00"));

/*        aList.add(stringToDate("2020-06-06 09:00:00"));
        bList.add(stringToDate("2020-06-06 12:00:00"));*/

        Date x = stringToDate("2020-06-06 08:00:00");
        Date y = stringToDate("2020-06-06 12:00:00");
        aList.add(x);
        bList.add(y);

        for (int i = 0; i < aList.size(); i++) {
            Date a = aList.get(i);
            Date b = bList.get(i);
            if ((x.before(b) && x.after(a) && y.after(b)) || (a.before(y) && a.after(x) && b.after(y))) {
                System.out.println("存在重叠时间段");
                return;
            }

        }
        System.out.println("正常。。。。");


    }

    public Date stringToDate(String str) throws Exception {
        SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        return sf.parse(str);
    }

}
